package com.csweimei.rentmanagementtreasure.tenant.ui.act.dayPaper;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.base.AppConfig;
import com.csweimei.rentmanagementtreasure.base.AppViewModelFactory;
import com.csweimei.rentmanagementtreasure.databinding.ActivityDayPaperBinding;
import com.csweimei.rentmanagementtreasure.http.entity.BindEntEntity;
import com.csweimei.rentmanagementtreasure.tenant.viewModel.DayPaperVM;

import me.goldze.mvvmhabit.base.BaseActivity;

public class DayPaperActivity extends BaseActivity<ActivityDayPaperBinding, DayPaperVM> {


    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_day_paper;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    BindEntEntity.DataDTO bean;
    @Override
    public void initParam() {
        super.initParam();
        bean = (BindEntEntity.DataDTO) getIntent().getSerializableExtra(AppConfig.BUNDLE_KEY);
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setActivity(this);
        viewModel.entity.set(bean);

    }

    @Override
    public DayPaperVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this,factory).get(DayPaperVM.class);
    }
}